<template>
  <div class="tinymce">
    <editor id="tinymce" v-model="tinymceHtml" :init="init"></editor>
  </div>
</template>

<script>
import tinymce from './../../static/tinymce/tinymce'
import './../../static/tinymce/themes/silver/theme'//汉化
import Editor from '@tinymce/tinymce-vue'
//按需引用需要的组件
import anchor from './../../static/tinymce/plugins/anchor' /*锚点*/
import autoresize from './../../static/tinymce/plugins/autoresize' /*自动扩充文本区域*/
import autosave from './../../static/tinymce/plugins/autosave' /*恢复上次的草稿*/
import charmap from './../../static/tinymce/plugins/charmap' /*特殊符号*/
import code from './../../static/tinymce/plugins/code' /*源代码*/
import codesample from './../../static/tinymce/plugins/codesample'  /*插入代码*/
import emoticons from './../../static/tinymce/plugins/emoticons' /*表情*/
import fullpage from './../../static/tinymce/plugins/fullpage'  /*元数据和文档属性*/
import fullscreen from './../../static/tinymce/plugins/fullscreen' /*全屏*/
import help from './../../static/tinymce/plugins/help' /*帮助*/
import hr from './../../static/tinymce/plugins/hr' /*水平分割线*/
import image from './../../static/tinymce/plugins/image' /*插入图片*/
import imagetools from './../../static/tinymce/plugins/imagetools' 
import insertdatetime from './../../static/tinymce/plugins/insertdatetime' /*插入日期时间*/
import link from './../../static/tinymce/plugins/link' /*链接*/
import media from './../../static/tinymce/plugins/media' /*插入媒体*/
import nonbreaking from './../../static/tinymce/plugins/nonbreaking' /*不间断空格*/
import pagebreak from './../../static/tinymce/plugins/pagebreak' /*分页符*/
import paste from './../../static/tinymce/plugins/paste' /*粘贴*/
import preview from './../../static/tinymce/plugins/preview' /*预览*/
import print from './../../static/tinymce/plugins/print' /*打印*/ 
import save from './../../static/tinymce/plugins/save' /*保存*/
import searchreplace from './../../static/tinymce/plugins/searchreplace' /*查找和替换*/
import spellchecker from './../../static/tinymce/plugins/spellchecker' /*拼写检查*/ 
import table from './../../static/tinymce/plugins/table' /*插入表格*/
import template from './../../static/tinymce/plugins/template' /*插入模板*/
import toc from './../../static/tinymce/plugins/toc' /*列表*/
import upfile from './../../static/tinymce/plugins/upfile' /*上传文件*/
import visualblocks from './../../static/tinymce/plugins/visualblocks' /*显示区块边框*/
import wordcount from './../../static/tinymce/plugins/wordcount' /*字数统计*/
import importword from './../../static/tinymce/plugins/importword' /*导入文件*/

export default {
  name: 'tinymce',
  data () {
    return {
      tinymceHtml: '',
      init: {
      	height: 500,
        language_url: './../../static/zh_CN.js',
        language: 'zh_CN',
        //皮肤
        skin_url: './../../static/tinymce/skins/ui/oxide',
        //功能组件
        plugins:
          'importword wordcount  anchor autoresize autosave charmap code codesample emoticons fullpage fullscreen help hr image insertdatetime link media nonbreaking pagebreak paste preview print save searchreplace spellchecker table template toc upfile visualblocks',
        //工具栏
        toolbar:[
        	'importword','save','upfile','fullpage','toc','wordcount',''
        ]
      }
    }
  },
  mounted () {
    tinymce.init({})// 页面加载的时候初始化组件
  },
  components: { Editor }
}
</script>
<style scoped>
</style>
